package DP.adapter.user.adapter;

import DP.adapter.user.adaptee.IOuterUserBaseInfo;
import DP.adapter.user.adaptee.IOuterUserHomeInfo;
import DP.adapter.user.adaptee.IOuterUserOfficeInfo;
import DP.adapter.user.target.IUserInfo;

import java.util.Map;

/**
 * @author msi
 * 适配器
 */
public class OuterUserInfo implements IUserInfo {
    private IOuterUserOfficeInfo officeInfo=null;
    private IOuterUserHomeInfo homeInfo=null;
    private IOuterUserBaseInfo baseInfo=null;

    private Map baseMap=null;
    private Map officeMap=null;
    private Map homeMap=null;

    public OuterUserInfo(IOuterUserOfficeInfo officeInfo,IOuterUserHomeInfo homeInfo,IOuterUserBaseInfo baseInfo){
        this.baseInfo=baseInfo;
        this.homeInfo=homeInfo;
        this.officeInfo=officeInfo;

        this.baseMap=this.baseInfo.getUserBaseInfo();
        this.homeMap=this.homeInfo.getUserHomeInfo();
        this.officeMap=this.officeInfo.getUserOfficeInfo();
    }

    @Override
    public String getUserName() {
        System.out.println("user name");
        return "userName";
    }

    @Override
    public String getHomeAddress() {
        System.out.println(this.homeMap.get("address"));
        return "address";
    }

    @Override
    public String getMobileNumber() {
        System.out.println("mobile number");
        return "mobile number";
    }

    @Override
    public String getOfficeTelNumber() {
        System.out.println("office number");
        return "office number";
    }

    @Override
    public String getJobPosition() {
        System.out.println("job");
        return "job";
    }

    @Override
    public String getHomeTelNumber() {
        System.out.println("home number");
        return "home number";
    }
}
